# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Darshit Shah <darnir@gmail.com>

pkgname=vint
pkgver=0.3.21
pkgrel=2
pkgdesc='Lint tool for Vim script Language'
arch=('any')
url=https://github.com/Vimjas/vint
license=('MIT')
depends=('python-ansicolor' 'python-chardet' 'python-setuptools' 'python-yaml')
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest')
conflicts=('python-vint')
replaces=('python-vint')
source=("$url/archive/v$pkgver/vint-v$pkgver.tar.gz")
b2sums=('926b46493030dc0daa477ded3cb70f2b825b4eb8054c14a4b824b97e7df60d0141cf1bcf4c33893afd870f51308b7156fb6e5870f320f8c9449fdca8fe78774f')

build() {
  cd vint-$pkgver
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd vint-$pkgver
  pytest
}

package() {
  cd vint-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/vint
  ln -s "$site_packages"/vim_vint-$pkgver.dist-info/LICENSE.txt \
    "$pkgdir"/usr/share/licenses/vint/LICENSE.txt
}
